import 'package:flutter/material.dart';
import 'package:yuan_hang_app/utils/size_utils.dart';

class WLine extends StatelessWidget {
  final Color? color;
  final double? width;
  final double height;
  final double marginLeft;
  final double marginTop;
  final double marginRight;
  final double marginBottom;
  final double borderRadius;

  WLine(
      {this.color,
      this.width,
      this.height = 0.5,
      this.marginLeft = 0.0,
      this.marginTop = 0.0,
      this.marginRight = 0.0,
      this.marginBottom = 0.0,
      this.borderRadius = 0.0});

  @override
  Widget build(BuildContext context) {
    if (width != null) {
      return Container(
        width: width ?? 1.px,
        height: height.px,
        decoration: BoxDecoration(borderRadius: BorderRadius.circular(borderRadius.px),  color: color ?? const Color(0xffECECEC),),
        margin: EdgeInsets.only(
            left: marginLeft ?? 0.0,
            top: marginTop ?? 0.0,
            right: marginRight ?? 0.0,
            bottom: marginBottom ?? 0.0),

      );
    } else if (width != null) {
      return Container(
        width: width?.px,
        decoration: BoxDecoration(borderRadius: BorderRadius.circular(borderRadius.px), color: color ?? const Color(0xffECECEC),),
        margin: EdgeInsets.only(
            left: marginLeft ?? 0.0,
            top: marginTop ?? 0.0,
            right: marginRight ?? 0.0,
            bottom: marginBottom ?? 0.0),

      );
    } else if (width == null) {
      return Container(
        height: height.px,
        decoration: BoxDecoration(borderRadius: BorderRadius.circular(borderRadius.px),   color: color ?? const Color(0xffECECEC),),
        margin: EdgeInsets.only(
            left: marginLeft ?? 0.0,
            top: marginTop ?? 0.0,
            right: marginRight ?? 0.0,
            bottom: marginBottom ?? 0.0),

      );
    } else {
      return const SizedBox();
    }
  }
}
